<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=utf-8" errorPage="/error.jsp" isELIgnored="false" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://www.opensymphony.com/oscache" prefix="cache" %>
<%@ taglib uri="http://atleap.blandware.com/taglib" prefix="atleap" %>
<html:xhtml />

<atleap:constants className="com.blandware.atleap.webapp.util.core.WebappConstants" scope="page" var="CONTENT_LOCALES_COLLECTION_KEY" />
<atleap:constants className="com.blandware.atleap.webapp.util.core.WebappConstants" var="CONTENT_FILE_NEW_FILENAME_KEY" scope="page" />
<atleap:constants className="com.blandware.atleap.webapp.util.core.WebappConstants" var="HTML_TEXT_FIELD_MAX_LENGTH" />
<atleap:javascript formName="contentResourceForm" staticJavascript="false" dynamicJavascript="true" method="validateForm" cdata="false" />
<atleap:content identifier="information" ignore="true" uri="/core/contentResource/file/callCreate"/>
<atleap:messages property="contentResourceAlreadyExists" /><br />
<atleap:messages property="contentResourceUnsupportedOrCorrupted" /><br />
<atleap:form action="core/contentResource/file/create" method="POST">
    <table cellpadding="0" cellspacing="0" border="0" class="modificationTable">
        <tr>
            <th>
                <div class="readOnlyField">
                    <atleap:message key="core.contentResource.form.mimeType" />:&nbsp;
                </div>
            </th>
            <td>
                <atleap:message key="core.contentResource.form.unknownMimeType" var="unknown" />
                <c:out value="${(contentResourceForm.mimeType != null) ? contentResourceForm.mimeType : unknown }" escapeXml="true" />
				<html:hidden property="mimeType" />
            </td>
        </tr>
        <tr>
            <th>
                <div class="readOnlyField">
                    <atleap:message key="core.contentResource.form.size" />:&nbsp;
                </div>
            </th>
            <td>
                <c:out value="${contentResourceForm.size}" escapeXml="true" />
                <html:hidden property="size" />
            </td>
        </tr>
        <tr>
            <th>
                <div class="readOnlyField">
                    <atleap:message key="core.contentResource.form.fileName" />:&nbsp;
                </div>
            </th>
            <td>
                <c:out value="${sessionScope[pageScope.CONTENT_FILE_NEW_FILENAME_KEY]}" escapeXml="true" />
            </td>
        </tr>
        <tr>
            <th>
                <atleap:label property="uri" styleClass="label" key="core.contentResource.form.uri" colon="false" helpTip="true" />
            </th>
            <td>
                <html:text property="uri" maxlength="${pageScope.HTML_TEXT_FIELD_MAX_LENGTH}" styleClass="text" />
            </td>
        </tr>
        <tr>
            <th>
                <atleap:label property="altUrl" styleClass="label" key="core.contentResource.form.altUrl" colon="false" helpTip="true" />
            </th>
            <td>
                <html:text property="altUrl" maxlength="${pageScope.HTML_TEXT_FIELD_MAX_LENGTH}" styleClass="text" styleId="altUriInput" />
				<a href="javascript:void(0);" title="<atleap:message key="core.commons.buttons.browseLinks" />" onclick="browseInPopup('<atleap:rewriteUrl action="/core/browser/browseContentPages" addLocaleSuffix="false"><atleap:param name="opening" value="true" /></atleap:rewriteUrl>', 'altUriInput', 800, 500); return false;">
					<img src="<atleap:rewriteUrl href="/images/theme/${appConfig['adminCssTheme']}/hyperlink.gif" />" title="<atleap:message key="core.commons.buttons.browseLinks" />" alt="<atleap:message key="core.commons.buttons.browseLinks" />"  /></a>
            </td>
        </tr>
        <tr>
			<td colspan="2" align="center">
				<atleap:label property="description" key="core.contentResource.form.description" colon="false" helpTip="true" />
			</td>
		</tr>
		<atleap:iterator items="${sessionScope[pageScope.CONTENT_LOCALES_COLLECTION_KEY]}" var="contentLocale">
			<tr>
				<th>
					<div class="languageField">
						<atleap:fieldValue valueMap="${contentLocale.title}" var="languageTitle" />
						<c:if test="${empty languageTitle}">
							<c:set var="languageTitle" value="${contentLocale.identifier}" />
						</c:if>
						<atleap:message key="core.contentResource.form.language" />:&nbsp;${languageTitle}
					</div>
				</th>
				<td>
                    <%--<html:textarea property="description(${contentLocale.identifier})" />--%>
                    <html:text property="description(${contentLocale.identifier})" maxlength="${pageScope.HTML_TEXT_FIELD_MAX_LENGTH}" styleClass="text" />
                </td>
			</tr>
		</atleap:iterator>
    </table>
    
    <atleap:cancel styleClass="button" type="back"><atleap:message key="core.commons.buttons.back" /></atleap:cancel>
    <atleap:submit styleClass="button"><atleap:message key="core.commons.buttons.create" /></atleap:submit>
    <atleap:cancel styleClass="button"><atleap:message key="core.commons.buttons.cancel" /></atleap:cancel>
</atleap:form>
